﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Web.Wap.Code;
using ZLCMS.Business.Util;

namespace ZLCMS.Web.Wap.Agent
{
    public partial class Barcode : AgentPageBase
    {
        protected string BarcodeImg { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            using(NHibernate.ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
            {
                string barcodeImg = session.CreateSQLQuery("select barcode_img from shop_agent_info where agent_account=:acc")
                    .SetParameter("acc", AgentAccount)
                    .UniqueResult<string>();

                BarcodeImg = FileKit.FirstFilePath(barcodeImg);
            }

            if (string.IsNullOrEmpty(BarcodeImg))
            {
                Response.Write("二维码不存在");
                Response.End();
            }
        }
    }
}